// Copyright (C) ZHENG Zhong <heavyzheng nospam-at gmail D0T com>
// http://www.zhengzhong.net/
//
// $Id: attribute.hpp 318 2009-03-02 14:03:21Z heavyzheng $
//

#ifndef ZZHENG_XML_SAX_ATTRIBUTE_HPP_20090122__
#define ZZHENG_XML_SAX_ATTRIBUTE_HPP_20090122__

#include <zzheng/xml/config.hpp>
#include <zzheng/xml/sax/types.hpp>

#include <string>
#include <vector>


namespace zzheng {
namespace xml {
namespace sax {

    //! This class represents an attribute associated to an element. It is is used in SAX.
    class attribute {

    public:

        explicit attribute(): name(), uri(), prefix(), value() {
            // Do nothing.
        }

        explicit attribute(const std::string& name,
                           const std::string& uri,
                           const std::string& prefix,
                           const std::string& value)
        : name(name), uri(uri), prefix(prefix), value(value) {
            // Do nothing.
        }

        // Use auto-generated copy constructor.
        // Use auto-generated copy assignment.
        // Use auto-generated destructor.

        std::string qname() const {
            return (prefix.empty() ? name : prefix + ":" + name);
        }

    public:

        std::string name;
        std::string uri;
        std::string prefix;
        std::string value;

    }; // class attribute

    //! Typedef of attribute list.
    typedef std::vector<attribute> attribute_list;


} // namespace zzheng::xml::sax
} // namespace zzheng::xml
} // namespace zzheng


#endif // ZZHENG_XML_SAX_ATTRIBUTE_HPP_20090122__





